package com.ssy.lingxi.search.api.feign;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.search.api.hystrix.TemplateChannelHystrix;
import com.ssy.lingxi.search.api.model.request.channel.TemplateChannelCommoditySearchRequest;
import com.ssy.lingxi.search.api.model.response.BrandResponse;
import com.ssy.lingxi.search.api.model.response.CategoryResponse;
import com.ssy.lingxi.search.api.model.response.channel.ChannelCommoditySearchResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

/**
 * 模板服务类--渠道商品
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/9/21
 */
@FeignClient(value = "search-service", fallback = TemplateChannelHystrix.class)
public interface ITemplateChannelFeign {

    /**
     * 查询一级品类信息
     * @return
     */
    @RequestMapping(value = "/search/channelCommodity/template/getFirstCategoryListByMemberId", method = RequestMethod.GET)
    Wrapper<List<CategoryResponse>> getFirstCategoryListByMemberId(
            @RequestParam(value = "shopId") Long shopId,
            @RequestParam(value = "memberId") Long memberId);

    /**
     * 查询二级品类信息
     * @return
     */
    @RequestMapping(value = "/search/channelCommodity/template/getSecondCategoryListByMemberId", method = RequestMethod.GET)
    Wrapper<List<CategoryResponse>> getSecondCategoryListByMemberId(
            @RequestParam(value = "shopId") Long shopId,
            @RequestParam(value = "memberId") Long memberId,
            @RequestParam(value = "categoryId") Long categoryId);

    /**
     * 查询品牌信息
     * @param current 当前页码
     * @param pageSize 每页条数
     * @param customerCategoryId 会员分类id
     * @param categoryId 平台分类id
     * @param memberId 会员id
     * @param name 品牌名称
     * @param idInList 包含
     * @param idNotInList 不包含
     * @return
     */
    @RequestMapping(value = "/search/channelCommodity/template/getBrandList", method = RequestMethod.GET)
    Wrapper<PageData<BrandResponse>> getBrandList(@RequestParam("current") Integer current, @RequestParam("pageSize") Integer pageSize,
                                                         @RequestParam(value = "shopId", required = false) Long shopId,
                                                         @RequestParam(value = "customerCategoryId",required = false) Long customerCategoryId,
                                                         @RequestParam(value = "categoryId",required = false) Long categoryId,
                                                         @RequestParam(value = "memberId",required = false) Long memberId,
                                                         @RequestParam(value = "memberRoleId",required = false) Long memberRoleId,
                                                         @RequestParam(value = "memberName",required = false) String memberName,
                                                         @RequestParam(value = "name",required = false) String name,
                                                         @RequestParam(value = "idInList",required = false) List<Long> idInList,
                                                         @RequestParam(value = "idNotInList",required = false) List<Long> idNotInList);

    /**
     * 查询商品信息
     * @param templateChannelCommoditySearchRequest 参数
     * @return
     */
    @RequestMapping(value = "/search/channelCommodity/template/searchCommodityList", method = RequestMethod.POST)
    Wrapper<PageData<ChannelCommoditySearchResponse>> searchCommodityList(@Valid @RequestBody TemplateChannelCommoditySearchRequest templateChannelCommoditySearchRequest);

}
